package game.Config;


import java.awt.Font;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.TrueTypeFont;
import org.newdawn.slick.geom.Circle;
import org.newdawn.slick.geom.Vector2f;

@SuppressWarnings("deprecation")
/**
 * This class contains all the information about one tower type-
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class TowerInfo {
	private TrueTypeFont font;
	private Image image;
	private String description;
	private float sightRadius;
	private float cost;
	/**
	 * Creates an ew tower infor.
	 * @param image The image of the tower.
	 * @param description The descripton of the tower.
	 * @param sightRadius The towers sight radius
	 * @param cost The cost to build a tower.
	 * @param font The font the tower will use when it prints its information.
	 */
	public TowerInfo(Image image, String description, float sightRadius,float cost,Font font){
		this.font = new TrueTypeFont(font,true);
		this.image = image.copy();
		this.description = description;
		this.sightRadius = sightRadius;
		this.cost = cost;
	}
	
	/**
	 * Returns the cost to build the tower.
	 * @return The cost to build the tower
	 */
	public float getCost(){
		return this.cost;
	}
	
	/**
	 * Returns a copy of the towers image.
	 * @return A copy of the towers image.
	 */
	public Image getImage(){
		return this.image.copy();
	}
	
	/**
	 * Prints the tower information at a given position.
	 * @param position The position the informaiton will be printed at.
	 * @param graphics The graphics.
	 */
	public void displayInfo(Vector2f position,Graphics graphics){
		font.drawString(position.x, position.y, description);
		font.drawString(position.x, position.y+font.getHeight(), "Cost: "+cost);
		Vector2f placing = Storage.getPosition();
		image.draw(placing.x,placing.y);
		
		Circle circle = new Circle(placing.x+image.getWidth()/2,placing.y+image.getHeight()/2,sightRadius);
		graphics.setColor(Config.SIGHT_RADIUS_COLOR);
		graphics.draw(circle);
		graphics.setColor(Config.STANDARD_COLOR);
	}
	
	
}
